<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>symbol</title>
</head>
<body>
<script>
class Car {
	// 静态属性
	static price = 100
	// 静态方法
	static sayHello () {
		console.log('sayHello:111');
	}
	constructor (id, name) {
		this.id = id;
		this._name = name;
	}
	getId () {
		return this.id;
	}
	setId (id) {
		this.id = id;
	}
	get name () {
		return this._name;
	}
	set name (val) {
		this._name = val;
	}
}
console.log(Car.price);
Car.sayHello();
const car1 = new Car(1, 'x1');
const car2 = new Car(2, 'x2');
console.log(car1);
console.log(car1.name);
console.log(car2);
</script>
<script type="text/javascript">
class Human {
	static age = 100
	static say1 () {
		console.log('say1:');
	}
	constructor (id) {
		this.id = id;
	}
	getId () {
		return this.id;
	}
	setId (id) {
		this.id = id;
	}
}
class Person extends Human {
	static money = 999
	static say2 () {
		console.log('say2:');
	}
	constructor (id, name) {
		super(id);
		this.name = name;
	}
	getName () {
		return this.id;
	}
	setName (name) {
		this.name = name;
	}
}
const person1 = new Person(1, 'x1');
console.log(person1);
console.log(person1.getId());
console.log(Person.age);//继承后也可以访问父类的静态属性和方法
</script>
</body>
</html>